package red.mlz.appconsumer.controller.category;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import red.mlz.appconsumer.feign.category.CategoryFeign;
import red.mlz.common.utils.Response;

@RestController
@Slf4j
public class CategoryController {

    @Autowired
    private CategoryFeign categoryFeign;

    @RequestMapping("/category/list")
    public Response getCategoryList(){
        return new Response(1001,categoryFeign.getCategoryList());
    }

    @RequestMapping("/category/third_level_category")
    public Response getThirdLevelCategory(@RequestParam Long parentId,
                                          @RequestParam(required = false) Long selectedId) {
        return new Response(1001,categoryFeign.getThirdLevelCategory(parentId,selectedId));
    }
}
